import {del, get, post, put} from '@/utils/request'

export function add(data) {
    return post('/home/role/add', data)
}

export function getInfo(page, pageSize, searchForm) {
    let url = '/home/role/list?page=' + page + '&pageSize=' + pageSize + '&phone=' + searchForm.phone
    if (searchForm.timeRange[0] != undefined && searchForm.timeRange[0] != '') {
        url += '&startTime=' + searchForm.timeRange[0];
    }
    if (searchForm.timeRange[1] != undefined && searchForm.timeRange[1] != '') {
        url += '&endTime=' + searchForm.timeRange[1];
    }
    return get(url)
}

export function update(data) {
    return put('/home/role/update', data)
}

export function updateStatus(data) {
    return put('/home/role/update-status', data)
}

export function delRole(id) {
    return del(`/home/role/delete/${id}`)
}


export function selList(name) {
    let url = '/home/role/sel-list?name=' + name
    return get(url)
}